<extend name="Layout:layout_content" />
<block name="body_main">
    <div class="xsui-form-hd">
        <h1>网站设置</h1>
    </div>
    <div class="xsui-page-header">
        <ul class="xsui-tabs">
            <li class="ui-state-active"><i class="fa fa-gears"></i><a href="#B">基本设置</a></li>
            <li class="ui-state-default"><i class="fa fa-folder"></i><a href="#C">内容设置</a></li>
            <li class="ui-state-default"><i class="fa fa-users"></i><a href="#U">用户设置</a></li>
            <li class="ui-state-default"><i class="fa fa-dashboard"></i><a href="#S">系统设置</a></li>
        </ul>
    </div>
    <form action="{:U('site_config_save')}" method="post" class="xsui-form xsui-form-vertical">
        <fieldset>
            <foreach name="configs" item="vo">
                <div class="xsui-form-field xsui-hidden" data-group="{$vo.group}">
                    <label>{$vo.title}：<span>（{$vo.remark}）</span></label>
                    <switch name="vo.type">
                    <case value="C">
                        <input type="text" name="{$vo.name}" placeholder="{$vo.title}" value="{$vo.value}" size="60" />
                    </case>
                    <case value="N">
                        <input type="number" name="{$vo.name}" placeholder="{$vo.title}" value="{$vo.value}" size="60" />
                    </case>
                    <case value="T">
                        <textarea name="{$vo.name}" placeholder="{$vo.title}" cols="60" rows="3">{$vo.value}</textarea>
                    </case>
                    <case value="A|E">
                        <select name="{$vo.name}" required="required">{:parse_htmlselect_options($vo['content'],$vo['value'])}</select>
                    </case>
                    </switch>
                </div>
            </foreach>
        </fieldset>
        <button type="submit" class="xsui-btn ui-state-default"><i class="fa fa-save"></i>保存</button><button type="reset" class="xsui-btn ui-state-default">重置</button>
    </form>
</block>
<block name="body_after">
    <script>
        $(function () {
            $('.xsui-tabs a').click(function () {
                toggle_fields($(this).attr('href').substring(1));
                $('.xsui-tabs li').removeClass('ui-state-active').addClass('ui-state-default');
                $(this).parent().removeClass('ui-state-default').addClass('ui-state-active');
            })
            toggle_fields('B');
        })
        // 切换字段 2015-11-7 SoChishun Added.
        function toggle_fields(group) {
            $('.xsui-form-field').hide();
            $('.xsui-form-field[data-group="' + group + '"]').show();
        }
    </script>
</block>